///加解密方式 aes;
import 'package:encrypt/encrypt.dart';

class Aes {
  static const _keyStr = '-huishang-xbsyxw'; // 解密用的key

  static Key get _keyUtf8 => Key.fromUtf8(_keyStr);

  static String get _timeStamp => DateTime.now().millisecondsSinceEpoch.toString();

  static IV get _iv => IV.fromLength(64);

  static Encrypter get _er => Encrypter(AES(_keyUtf8, mode: AESMode.ecb));

  // 加密
  static String encrypt(String word) => _er.encrypt(_timeStamp + word, iv: _iv).base64;

  // 解密
  static decrypt(String text) => _er.decrypt64(text, iv: _iv);
}
